<?php

/**
 * Product form.
 *
 * @package    Manager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ProductForm extends BaseProductForm
{
	public function configure()
	{

		$this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'clientCharge_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'), 'add_empty' => false)),
      'agentCharge_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'), 'add_empty' => false)),
      'blogger_id'      => new sfWidgetFormDoctrineChoice(array('label'=>"ブログ",'model' => $this->getRelatedModelName('Blogger'), 'add_empty' => false)),
      'product'         => new sfWidgetFormInputText(array('label'=>"商品")),
	  'url'             => new sfWidgetFormInputText(),
	  'date'            => new sfWidgetFormInputText(array('label'=>"掲載開始時間")),
      'starttime'		=> new sfWidgetFormTime(array('label' => 'Start Time', 'with_seconds' => false)),
	  'endtime'			=> new sfWidgetFormTime(array('label' => 'End Time', 'with_seconds' => false)),
		//'startdate'       => new sfWidgetFormInputText(),
		//'enddate'         => new sfWidgetFormInputText(),
      'pledgetime'      => new sfWidgetFormInputText(array('label'=>"保証時間")),
      'sale'            => new sfWidgetFormInputText(array('label'=>"クライアントの価格")),
      'cost'            => new sfWidgetFormInputText(array('label'=>"ブログの価格")),
      'deadline_date'        => new sfWidgetFormInputText(array('label'=>"下書きの締切り")),
	  'deadline_time'	=> new sfWidgetFormTime(),
	  'agent_note'          => new sfWidgetFormTextarea(array('label'=>"事務所の備考")),
		//'agent_payment_time'  => new sfWidgetFormDate(array( 'format'=>'%year%年%month%月%day%日' )),
	  'agent_payment_time' => new sfWidgetFormInputText(array('label'=>"事務所のお支払い日")),
 	  'client'			=> new sfWidgetFormDoctrineChoice(array('label'=>"クライアント",'model' => 'Client','add_empty' => false)),
	  'clientcharge_name'=>new sfWidgetFormInputText(array('label'=>"クライアントの担当者の名前")),
	  //'clientcharge_email'=>new sfWidgetFormTextArea(array('label'=>"クライアントの担当者のメール")),
	  'agent'			=> new sfWidgetFormDoctrineChoice(array('label'=>"事務所",'model' => 'Agent','add_empty' => false)),
	  'agentcharge_name'=>new sfWidgetFormInputText(array('label'=>"事務所担当者の名前")),
	  //'agentcharge_email'=>new sfWidgetFormTextArea(array('label'=>"事務所担当者のメール")),
      'client_note'         => new sfWidgetFormTextarea(array('label'=>"クライアントの備考")),
		//'client_payment_time' => new sfWidgetFormDate(array( 'format'=>'%year%年%month%月%day%日' )),
      'client_payment_time' => new sfWidgetFormInputText(array('label'=>"クライアントのお支払い日")),

	  'client_request_date' => new sfWidgetFormInputText(array('label'=>"クライアントの請求日")),
	  'agent_request_date' => new sfWidgetFormInputText(array('label'=>"事務所の請求日")),
	  'user_gmail_acount'=>new sfWidgetFormInputText(array('label'=>"ユーザーGメール")),
	  'user_gmail_password'=>new sfWidgetFormInputPassword(array('label'=>"ユーザーGメールのパースワード")),

		));

		$this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'clientCharge_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'), 'required' => false)),
      'agentCharge_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'), 'required' => false)),
      'blogger_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'))),
      'product'         => new sfValidatorString(array('max_length' => 255)),
	  'url'             => new sfValidatorString(array('max_length' => 255)),
      'date'            => new sfValidatorString(array('max_length' => 255)),
      'starttime'		=> new sfValidatorTime(),
	  'endtime'			=> new sfValidatorTime(),
		//'startdate'       => new sfValidatorString(array('max_length' => 255)),
		//'enddate'         => new sfValidatorString(array('max_length' => 255)),
      'pledgetime'      => new sfValidatorInteger(array('required' => false)),
      'sale'            => new sfValidatorInteger(array('required' => false)),
      'cost'            => new sfValidatorInteger(array('required' => false)),
      'deadline_date'        => new sfValidatorString(array('max_length' => 255)),
	  'deadline_time'	=>new sfValidatorTime(),
	  'client_note'         => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
		//'client_payment_time' => new sfValidatorDate(),
	  'client_payment_time' => new sfValidatorString(array('max_length'=>255)),
      'client'			=> new sfValidatorDoctrineChoice(array('model' => 'Client')),
	  'clientcharge_name'=>new sfValidatorString(array('max_length' => 255)),
	  //'clientcharge_email'=>new sfValidatorString(array('max_length' => 4000, 'required' => true)),
	  'agent'			=> new sfValidatorDoctrineChoice(array('model' => 'Agent')),
	  'agentcharge_name'=>new sfValidatorString(array('max_length' => 255)),
	  //'agentcharge_email'=>new sfValidatorString(array('max_length' => 4000, 'required' => true)),
		//'agent_payment_time'  => new sfValidatorDate(),
	  'agent_payment_time' => new sfValidatorString(array('max_length'=>255)),
	  'agent_note'          => new sfValidatorString(array('max_length' => 4000, 'required' => false)),

	  'client_request_date' => new sfValidatorString(array('max_length'=>255)),
	  'agent_request_date' => new sfValidatorString(array('max_length'=>255)),
	  'user_gmail_acount'=>new sfValidatorString(array('max_length' => 255, 'required'=>true)),
	  'user_gmail_password'=>new sfValidatorString(array('max_length' => 255,'required'=>true)),



		));

		$this->widgetSchema->setNameFormat('product[%s]');

		$this->validatorSchema['user_gmail_acount'] = new sfValidatorAnd(array(
		$this->validatorSchema['user_gmail_acount'],
		new sfValidatorEmail(array(), array('invalid' => 'Gmail address is invalid.')),
		));


	}
}
